package com.ehome.poct.core.service.report;

import com.ehome.core.service.AbstractCrudServiceImpl;
import com.ehome.poct.core.api.dto.report.BldUniAnalysisDTO;
import com.ehome.poct.core.api.virtual.BldUniAnalysisService;
import com.ehome.poct.core.repository.report.BldUniAnalysisRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * 血常规联机检测分析SerivceImlp
 *
 * @author wuyingchao
 * @Date 2022-05-20 10:38
 */
@Service
@AllArgsConstructor
public class BldUniAnalysisServiceImpl extends AbstractCrudServiceImpl<BldUniAnalysisDTO> implements BldUniAnalysisService {
    private final BldUniAnalysisRepository analysisRepository;

    @Override
    public BldUniAnalysisDTO getCrpSaaUniByCode(String code) {
        return Optional.ofNullable(analysisRepository.selectByCode(code, 1))
                .orElseGet(() -> analysisRepository.selectByCode("00000000000000", 1));
    }
}